#创建链接数据库
import pymysql
#打开数据库连接
conn = pymysql.connect('122.112.167.247',user = "root",passwd = "Xiaoke19980812..",db = "virus_minitor")
#获取游标
cursor=conn.cursor()
# 方法1：
def _reCon (): 
    """ MySQLdb.OperationalError异常"""
    # self.con.close() 
    while True:
        try: 
            conn.ping()
            break
        except :
            conn.ping(True)
   
def getEmailList():
    _reCon()
    emailList=[]
    cursor.execute("select email from tb_email")
    while 1:
        res=cursor.fetchone()
        if res is None:
            break
        emailList.append(res[0])
        return emailList


